<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="product.aspx.cs" Inherits="product" Title="Product" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div style="margin-bottom:20px">
        <h3>
            <asp:Label ID="lblCatName" runat="server" />
        </h3>    
        <asp:Label ID="lblProNum" runat="server" />
    </div>

    <asp:GridView ID="gvProduct" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="ProductID"
        DataSourceID="odsProducts" GridLines="None" PageSize="5" ShowHeader="False" CssClass="myGridView">        
        <Columns>       
            <asp:TemplateField SortExpression="UnitPrice" ShowHeader="False">
                <ItemTemplate>
                
                <table style="border:solid 1px #9D9D9D; margin-bottom:20px; background-color:#FFFFFF">
                      <tr>
                        <td style="background-color:#E9E9E9; border-bottom:solid 1px #9D9D9D" colspan="2" valign="middle">
                            <h4>
                                <div style="float:left">
                                
                                    <asp:HyperLink ID="hplProductID" runat="server" NavigateUrl='<%# Eval("ProductID", "productdetail.aspx?readID={0}") %>'
                                                        Text='<%# Eval("ProductName") %>'>
                                    </asp:HyperLink>
                                
                                </div>
                                <div style="text-align:right; width:100px; float:right"><asp:ImageButton ID="lblProductRating" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, ("RatingImage")) %>' 
                                 PostBackUrl='<%# Eval("ProductID", "productdetail.aspx?readID={0}#review") %>'/></div>
                            </h4>
                        </td>
                        
                      </tr>
                      <tr>
                        <td style="text-align:center">
                            <asp:Image ID="myImage" runat="server" ImageUrl='<%# Eval("Picture") %>' Width="100px" Height="100px" />
                        </td>
                        <td>
                            <asp:Label ID="lblDescriptionBrief" runat="server" Text='<%# Eval("DescriptionBrief") %>'/>
                            <asp:HyperLink ID="hlReadMore" runat="server" NavigateUrl='<%# Eval("ProductID", "productdetail.aspx?readID={0}") %>'>read more</asp:HyperLink>
                        </td>
                      </tr>
                      <tr>
                        <td style="text-align:center">
                            <asp:ImageButton ID="hlMoreDetail" runat="server"
                            ImageUrl="~/CoreLayout/Images/more_details.gif" PostBackUrl='<%# Eval("ProductID", "productdetail.aspx?readID={0}") %>' />
                        </td>
                        <td style="text-align:center">
                            <asp:Label ID="lblUnitPrice" runat="server" Text='<%# Bind("UnitPrice", "{0:C}") %>' ForeColor="RED" />
                        </td>
                      </tr>
                </table>                                                                                                   
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <PagerSettings Mode="NumericFirstLast"/>        
        <PagerStyle HorizontalAlign="Right" />
    </asp:GridView>
    
    <asp:ObjectDataSource ID="odsProducts" runat="server" SelectMethod="GetByCategoryID"
        TypeName="Bll.ProductBll">
        <SelectParameters>
            <asp:QueryStringParameter ConvertEmptyStringToNull="False" Name="categoryID" QueryStringField="CatID" DefaultValue="1"
                Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>   
    
</asp:Content>

